
print.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <_strcpy>:
#include <stdlib.h>
#include <string.h>
#include <assert.h>

char *_strcpy(char *dest, const char *src)
{
   0:	e92d4800 	push	{fp, lr}
   4:	e28db004 	add	fp, sp, #4
   8:	e24dd010 	sub	sp, sp, #16
   c:	e50b0010 	str	r0, [fp, #-16]       ; dest
  10:	e50b1014 	str	r1, [fp, #-20]	; 0xffffffec src
	assert( (dest != NULL) && (src != NULL));
  14:	e51b3010 	ldr	r3, [fp, #-16]      ; dese
  18:	e3530000 	cmp	r3, #0              ; ?= 0
  1c:	0a000002 	beq	2c <_strcpy+0x2c>
  20:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec src
  24:	e3530000 	cmp	r3, #0          ; ?= -
  28:	1a000004 	bne	40 <_strcpy+0x40>
  2c:	e59f3054 	ldr	r3, [pc, #84]	; 88 <_strcpy+0x88>
  30:	e3a02008 	mov	r2, #8
  34:	e59f1050 	ldr	r1, [pc, #80]	; 8c <_strcpy+0x8c>
  38:	e59f0050 	ldr	r0, [pc, #80]	; 90 <_strcpy+0x90>
  3c:	ebfffffe 	bl	0 <__assert>
	char *adr;
	
	adr = dest;
  40:	e51b3010 	ldr	r3, [fp, #-16] ; dest
  44:	e50b3008 	str	r3, [fp, #-8]  ; adr
	while ( (*dest++ = *src++) != '\0');
  48:	e1a00000 	nop			; (mov r0, r0)
  4c:	e51b3010 	ldr	r3, [fp, #-16] ; dest
  50:	e2832001 	add	r2, r3, #1     ; dest+1
  54:	e50b2010 	str	r2, [fp, #-16] ; dest
  58:	e51b2014 	ldr	r2, [fp, #-20]	; 0xffffffec src
  5c:	e2821001 	add	r1, r2, #1      ; r1 = src + 1
  60:	e50b1014 	str	r1, [fp, #-20]	; 0xffffffec src
  64:	e5d22000 	ldrb	r2, [r2]    ; get src value
  68:	e5c32000 	strb	r2, [r3]    ; dest = src
  6c:	e5d33000 	ldrb	r3, [r3]    ; *dest
  70:	e3530000 	cmp	r3, #0
  74:	1afffff4 	bne	4c <_strcpy+0x4c>
	
	return adr;
  78:	e51b3008 	ldr	r3, [fp, #-8]
}
  7c:	e1a00003 	mov	r0, r3
  80:	e24bd004 	sub	sp, fp, #4
  84:	e8bd8800 	pop	{fp, pc}
  88:	00000098 	.word	0x00000098
  8c:	00000000 	.word	0x00000000
  90:	00000008 	.word	0x00000008

00000094 <main>:

int main()
{
  94:	e92d4810 	push	{r4, fp, lr}
  98:	e28db008 	add	fp, sp, #8
  9c:	e24dd024 	sub	sp, sp, #36	; 0x24
	char name[5] = "asdf";
  a0:	e59f20f8 	ldr	r2, [pc, #248]	; 1a0 <main+0x10c>
  a4:	e24b3020 	sub	r3, fp, #32     ; r3 = fp - 32 = name
  a8:	e8920003 	ldm	r2, {r0, r1}    ; r0=r2=as, r1=r2+4=df
  ac:	e5830000 	str	r0, [r3]        ; [name] = as
  b0:	e2833004 	add	r3, r3, #4      ; name+4
  b4:	e5c31000 	strb	r1, [r3]    ; name = df
	char *p1 = "name";
  b8:	e59f30e4 	ldr	r3, [pc, #228]	; 1a4 <main+0x110>
  bc:	e50b3010 	str	r3, [fp, #-16]  ; p1
	char *p2;
	int i;
	

	p2 = (char *)malloc(20);
  c0:	e3a00014 	mov	r0, #20
  c4:	ebfffffe 	bl	0 <malloc>
  c8:	e1a03000 	mov	r3, r0         ; r3 = malloc
  cc:	e50b3018 	str	r3, [fp, #-24]	; 0xffffffe8    p2 = malloc
	memset(p2, 0, 20);
  d0:	e3a02014 	mov	r2, #20
  d4:	e3a01000 	mov	r1, #0
  d8:	e51b0018 	ldr	r0, [fp, #-24]	; 0xffffffe8    p2
  dc:	ebfffffe 	bl	0 <memset>
	
	p2 = "xiaozhixiaozhixiaozhixiaozhixiaozhixiaozhi";
  e0:	e59f30c0 	ldr	r3, [pc, #192]	; 1a8 <main+0x114>
  e4:	e50b3018 	str	r3, [fp, #-24]	; 0xffffffe8    p2
	//*p2++ = 'b';
	//*p2++ = 'c';
	
	//					4	4		4		5
	printf(" == %s %d %d %d %d\n", p1, strlen(p1), sizeof(p1), strlen(name), sizeof(name));	
  e8:	e51b0010 	ldr	r0, [fp, #-16] ; r0 = p1
  ec:	ebfffffe 	bl	0 <strlen>     ; strlen(p1)
  f0:	e1a04000 	mov	r4, r0  ; r4 = strlen(p1)
  f4:	e24b3020 	sub	r3, fp, #32 ; r3 = fp - 32
  f8:	e1a00003 	mov	r0, r3      ; r0 = fp - 32 = name address
  fc:	ebfffffe 	bl	0 <strlen>  ; strlen(name)
 100:	e1a02000 	mov	r2, r0      ; r2 = strlen(name)
 104:	e3a03005 	mov	r3, #5      ; r3 = 5
 108:	e58d3004 	str	r3, [sp, #4] ; sp + 4 = 5
 10c:	e58d2000 	str	r2, [sp]     ; sp = strlen(name)
 110:	e3a03004 	mov	r3, #4       ; r3 = 4
 114:	e1a02004 	mov	r2, r4       ; r2 = strlen(p1)
 118:	e51b1010 	ldr	r1, [fp, #-16] ; r1 = p1
 11c:	e59f0088 	ldr	r0, [pc, #136]	; 1ac <main+0x118>
 120:	ebfffffe 	bl	0 <printf>
	printf(" == %s %d %d\n", p2, strlen(p2), sizeof(p2));	
 124:	e51b0018 	ldr	r0, [fp, #-24]	; 0xffffffe8    p2
 128:	ebfffffe 	bl	0 <strlen>     
 12c:	e1a02000 	mov	r2, r0  ; r2 = strlen(p2)
 130:	e3a03004 	mov	r3, #4  ; r3 = 4
 134:	e51b1018 	ldr	r1, [fp, #-24]	; 0xffffffe8    p2
 138:	e59f0070 	ldr	r0, [pc, #112]	; 1b0 <main+0x11c>
 13c:	ebfffffe 	bl	0 <printf>
	
	//while(*p2++ = *p1++);
	//while((*p2++ = *p1++) != 4);
	for (i = 0; i < 3; i++)
 140:	e3a03000 	mov	r3, #0
 144:	e50b3014 	str	r3, [fp, #-20]	; 0xffffffec    i 
 148:	ea00000b 	b	17c <main+0xe8>
		name[i] = *p1++;
 14c:	e51b3010 	ldr	r3, [fp, #-16] ; r3 = p1
 150:	e2832001 	add	r2, r3, #1     ; r2 = p1+1
 154:	e50b2010 	str	r2, [fp, #-16] ; save p1+1
 158:	e5d31000 	ldrb	r1, [r3]   ; r1 = *p1++
 15c:	e24b2020 	sub	r2, fp, #32    ; r2 = fp - 32 = name
 160:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec    i
 164:	e0823003 	add	r3, r2, r3      ; r3 = name + i
 168:	e1a02001 	mov	r2, r1          ; r2 = *p1++
 16c:	e5c32000 	strb	r2, [r3]    ; name[i] = *p1++
	printf(" == %s %d %d %d %d\n", p1, strlen(p1), sizeof(p1), strlen(name), sizeof(name));	
	printf(" == %s %d %d\n", p2, strlen(p2), sizeof(p2));	
	
	//while(*p2++ = *p1++);
	//while((*p2++ = *p1++) != 4);
	for (i = 0; i < 3; i++)
 170:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec
 174:	e2833001 	add	r3, r3, #1
 178:	e50b3014 	str	r3, [fp, #-20]	; 0xffffffec
 17c:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec
 180:	e3530002 	cmp	r3, #2
 184:	dafffff0 	ble	14c <main+0xb8>
		name[i] = *p1++;
	//*p2 = '\0';
	printf("%s\n", name);
 188:	e24b3020 	sub	r3, fp, #32
 18c:	e1a00003 	mov	r0, r3
 190:	ebfffffe 	bl	0 <puts>
}
 194:	e1a00003 	mov	r0, r3
 198:	e24bd008 	sub	sp, fp, #8
 19c:	e8bd8810 	pop	{r4, fp, pc}
 1a0:	00000090 	.word	0x00000090
 1a4:	00000038 	.word	0x00000038
 1a8:	00000040 	.word	0x00000040
 1ac:	0000006c 	.word	0x0000006c
 1b0:	00000080 	.word	0x00000080
